package cappuccino.couldbook.core.image;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;

import java.io.InputStream;

import cappuccino.couldbook.App;
import rx.Observable;
import rx.Observer;
import rx.Subscriber;

/**
 * Created by Administrator on 2016/9/11.
 */
public class ImageReader {
    private static final String TAG = "ImageReader";

    static public Observable<Bitmap> getReader(final int res) {
        return Observable.create(new Observable.OnSubscribe<Bitmap>() {
            @Override
            public void call(Subscriber<? super Bitmap> subscriber) {
                Log.v(TAG,"start");
                Bitmap bitmap = BitmapFactory.decodeResource(App.getInstance().getResources(), res);
                subscriber.onNext(bitmap);
                subscriber.onCompleted();
                Log.v(TAG,"finish");
            }
        });
    }

}
